﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace Tenebrous_Manor.Navigation
{
    static public class RoomGraphics
    {
        #region basement
        public static Texture2D[] bighole = new Texture2D[3];
        #endregion

        #region bedroom
        static public Texture2D[,] bed = new Texture2D[3,3];
        static public Texture2D[] cupboard = new Texture2D[2];
        static public Texture2D[] mirror = new Texture2D[3];
        #endregion

        #region floors
        static public Texture2D[] kitchenfloor = new Texture2D[2];
        static public Texture2D labfloor;
        static public Texture2D stonefloor;
        static public Texture2D[] woodfloor = new Texture2D[5];
        #endregion

        #region foyer
        static public Texture2D[,] upper_stair = new Texture2D[2,3];
        #endregion

        #region lab
        static public Texture2D[,] lab_equipment = new Texture2D[2, 2];
        #endregion

        #region lower landing
        static public Texture2D[] lower_stair = new Texture2D[3];
        static public Texture2D box;
        #endregion

        #region junkroom
        static public Texture2D junk;
        #endregion

        #region kitchen
        static public Texture2D counter;
        static public Texture2D countercorner;
        static public Texture2D fridge;
        static public Texture2D sink;
        static public Texture2D stove;
        static public Texture2D[,] table = new Texture2D[2,2];
        #endregion

        #region main entrance
        static public Texture2D[,] carpet = new Texture2D[3,3];
        static public Texture2D desktop;
        static public Texture2D deskbottom;
        #endregion

        #region misc
        static public Texture2D door;
        static public Texture2D doorcarpetup;
        static public Texture2D doorcarpetbottom;
        static public Texture2D doorcarpetleft;
        static public Texture2D doorcarpetright;
        static public Texture2D[] hole = new Texture2D[3];
        static public Texture2D key;
        static public Texture2D leftdoor;
        static public Texture2D leftdoubledoorcarpet;
        static public Texture2D[] note = new Texture2D[3];
        static public Texture2D rightdoor;
        static public Texture2D rightdoubledoorcarpet;
        static public Texture2D screwdriver;
        #endregion

        #region study
        static public Texture2D bookshelf;
        static public Texture2D bookshelfback;
        static public Texture2D[,] studydesk = new Texture2D[3, 2];
        static public Texture2D trapdoor;
        #endregion

        #region upper landing
        static public Texture2D[,] stairtop = new Texture2D[2, 3];
        static public Texture2D brokendoor;
        #endregion

        #region wall
        static public Texture2D sidesandbottomwall;
        static public Texture2D stonewall;
        static public Texture2D[] wallpaper = new Texture2D[4];
        static public Texture2D woodwall;
        #endregion

        static Random rand = new Random((int)DateTime.Now.Ticks);
        static Tuple<int, int>[] rand_junk = new Tuple<int,int>[50];

        static public void Initialize()
        {
            for (int n = 0; n <= rand_junk.Length - 1; n++)
            {
                rand_junk[n] = Tuple.Create(rand.Next(2 * 85, 7 * 85), rand.Next(2 * 85, 7 * 85));
            }
        }
        
        static public void Draw(SpriteBatch spriteBatch, Room current_room)
        {
            
            #region Walls
            for (int i = 1; i <= GameConstants.COL_COUNT - 2; i++)
            {
                spriteBatch.Draw(woodwall, new Vector2(i * GameConstants.tileSize.X, 0), Color.White);
            }

            for (int j = 0; j <= GameConstants.ROW_COUNT - 1; j++)
            {
                spriteBatch.Draw(sidesandbottomwall, new Vector2(0, j * GameConstants.tileSize.Y), Color.White);
                spriteBatch.Draw(sidesandbottomwall, new Vector2((GameConstants.COL_COUNT - 1) * GameConstants.tileSize.X, j * GameConstants.tileSize.Y), Color.White);
            }

            for (int i = 0; i <= GameConstants.COL_COUNT - 1; i++)
            {
                spriteBatch.Draw(sidesandbottomwall, new Vector2(i * GameConstants.tileSize.X, (GameConstants.ROW_COUNT - 1) * GameConstants.tileSize.Y), Color.White);
            }

            #endregion
            #region floor
            for (int k = 1; k <= GameConstants.COL_COUNT - 2; k++)
            {
                /*if(k % 2 == 1)
                    for (int j = 1; j <= GameConstants.ROW_COUNT - 2; j++)
                    {
                         spriteBatch.Draw(woodfloor[j%3], new Vector2(k * GameConstants.tileSize.X, j*GameConstants.tileSize.Y), Color.White);
                    }
                else
                    for (int m = 1; m <= GameConstants.ROW_COUNT - 2; m++)
                    {
                        spriteBatch.Draw(woodfloor[(m%2)+3], new Vector2(k * GameConstants.tileSize.X, m * GameConstants.tileSize.Y), Color.White);
                    }*/
                for (int j = 1; j <= GameConstants.ROW_COUNT - 2; j++)
                {
                    spriteBatch.Draw(woodfloor[0], new Vector2(k * GameConstants.tileSize.X, j * GameConstants.tileSize.Y), Color.White);
                }
            }
            #endregion

            #region switch
            switch (current_room)
            {
                #region FIRST FLOOR
                case Room.MAIN_ENTRANCE:
                    #region doors + mats
                    //door to foyer
                    spriteBatch.Draw(leftdoor, new Vector2(4 * GameConstants.tileSize.X, 0), Color.White);
                    spriteBatch.Draw(leftdoubledoorcarpet, new Vector2(4 * GameConstants.tileSize.X, GameConstants.tileSize.Y - 40), Color.White);
                    spriteBatch.Draw(rightdoor, new Vector2(5 * GameConstants.tileSize.X, 0), Color.White);
                    spriteBatch.Draw(rightdoubledoorcarpet, new Vector2(5 * GameConstants.tileSize.X, GameConstants.tileSize.Y - 40), Color.White);

                    //door to outside
                    spriteBatch.Draw(leftdoubledoorcarpet, new Vector2(4 * GameConstants.tileSize.X, 8 * GameConstants.tileSize.Y), Color.White);
                    spriteBatch.Draw(rightdoubledoorcarpet, new Vector2(5 * GameConstants.tileSize.X, 8 * GameConstants.tileSize.Y), Color.White);
                    #endregion

                    #region carpet
                    spriteBatch.Draw(carpet[0, 0], new Vector2(2 * GameConstants.tileSize.X, 2 * GameConstants.tileSize.Y), Color.White);
                    for (int n = 3; n <= 6; n++)
                        spriteBatch.Draw(carpet[0, 1], new Vector2(n * GameConstants.tileSize.X, 2 * GameConstants.tileSize.Y), Color.White);
                    spriteBatch.Draw(carpet[0, 2], new Vector2(7 * GameConstants.tileSize.X, 2 * GameConstants.tileSize.Y), Color.White);

                    for (int i = 3; i <= 6; i++)
                    {
                        spriteBatch.Draw(carpet[1, 0], new Vector2(2 * GameConstants.tileSize.X, i * GameConstants.tileSize.Y), Color.White);
                        for (int n = 3; n <= 6; n++)
                            spriteBatch.Draw(carpet[1, 1], new Vector2(n * GameConstants.tileSize.X, i * GameConstants.tileSize.Y), Color.White);
                        spriteBatch.Draw(carpet[1, 2], new Vector2(7 * GameConstants.tileSize.X, i * GameConstants.tileSize.Y), Color.White);
                    }

                    spriteBatch.Draw(carpet[2, 0], new Vector2(2 * GameConstants.tileSize.X, 7 * GameConstants.tileSize.Y), Color.White);
                    for (int n = 3; n <= 6; n++)
                        spriteBatch.Draw(carpet[2, 1], new Vector2(n * GameConstants.tileSize.X, 7 * GameConstants.tileSize.Y), Color.White);
                    spriteBatch.Draw(carpet[2, 2], new Vector2(7 * GameConstants.tileSize.X, 7 * GameConstants.tileSize.Y), Color.White);
                    #endregion

                    #region save table
                    spriteBatch.Draw(desktop, new Vector2(1 * GameConstants.tileSize.X, 7 * GameConstants.tileSize.Y), Color.White);
                    spriteBatch.Draw(deskbottom, new Vector2(1 * GameConstants.tileSize.X, 8 * GameConstants.tileSize.Y), Color.White);
                    #endregion
                    break;
                case Room.FOYER:
                    #region stairs
                    spriteBatch.Draw(upper_stair[0, 0], new Vector2(4 * GameConstants.tileSize.X - 40, 0), Color.White);
                    spriteBatch.Draw(upper_stair[0, 1], new Vector2(4 * GameConstants.tileSize.X + 40, 0), Color.White);
                    spriteBatch.Draw(upper_stair[0, 2], new Vector2(5 * GameConstants.tileSize.X + 40, 0), Color.White);
                    spriteBatch.Draw(upper_stair[1, 0], new Vector2(4 * GameConstants.tileSize.X - 40, GameConstants.tileSize.Y), Color.White);
                    spriteBatch.Draw(upper_stair[1, 1], new Vector2(4 * GameConstants.tileSize.X + 40, GameConstants.tileSize.Y), Color.White);
                    spriteBatch.Draw(upper_stair[1, 2], new Vector2(5 * GameConstants.tileSize.X + 40, GameConstants.tileSize.Y), Color.White);
                    #endregion

                    #region doors
                    //door to kitchen
                    spriteBatch.Draw(doorcarpetright, new Vector2(8 * GameConstants.tileSize.X, 7 * GameConstants.tileSize.Y), Color.White);

                    //door to junk room
                    spriteBatch.Draw(doorcarpetleft, new Vector2(GameConstants.tileSize.X, 2 * GameConstants.tileSize.Y), Color.White);
                    //door to main entrance
                    spriteBatch.Draw(leftdoubledoorcarpet, new Vector2(4 * GameConstants.tileSize.X, 8 * GameConstants.tileSize.Y), Color.White);
                    spriteBatch.Draw(rightdoubledoorcarpet, new Vector2(5 * GameConstants.tileSize.X, 8 * GameConstants.tileSize.Y), Color.White);
                    #endregion

                    #region carpet
                    spriteBatch.Draw(carpet[0, 0], new Vector2(2 * GameConstants.tileSize.X, 2 * GameConstants.tileSize.Y), Color.White);
                    for (int n = 3; n <= 6; n++)
                        spriteBatch.Draw(carpet[0, 1], new Vector2(n * GameConstants.tileSize.X, 2 * GameConstants.tileSize.Y), Color.White);
                    spriteBatch.Draw(carpet[0, 2], new Vector2(7 * GameConstants.tileSize.X, 2 * GameConstants.tileSize.Y), Color.White);

                    for (int i = 3; i <= 6; i++)
                    {
                        spriteBatch.Draw(carpet[1, 0], new Vector2(2 * GameConstants.tileSize.X, i * GameConstants.tileSize.Y), Color.White);
                        for (int n = 3; n <= 6; n++)
                            spriteBatch.Draw(carpet[1, 1], new Vector2(n * GameConstants.tileSize.X, i * GameConstants.tileSize.Y), Color.White);
                        spriteBatch.Draw(carpet[1, 2], new Vector2(7 * GameConstants.tileSize.X, i * GameConstants.tileSize.Y), Color.White);
                    }

                    spriteBatch.Draw(carpet[2, 0], new Vector2(2 * GameConstants.tileSize.X, 7 * GameConstants.tileSize.Y), Color.White);
                    for (int n = 3; n <= 6; n++)
                        spriteBatch.Draw(carpet[2, 1], new Vector2(n * GameConstants.tileSize.X, 7 * GameConstants.tileSize.Y), Color.White);
                    spriteBatch.Draw(carpet[2, 2], new Vector2(7 * GameConstants.tileSize.X, 7 * GameConstants.tileSize.Y), Color.White);
                    #endregion
                    break;
                case Room.KITCHEN:
                    #region Walls
                    for (int i = 1; i <= GameConstants.COL_COUNT - 2; i++)
                    {
                        spriteBatch.Draw(wallpaper[i % 4], new Vector2(i * GameConstants.tileSize.X, 0), Color.White);
                    }

                    #endregion

                    #region floor
                    for (int k = 1; k <= GameConstants.COL_COUNT - 2; k++)
                    {
                        for (int j = 1; j <= GameConstants.ROW_COUNT - 2; j++)
                        {
                            spriteBatch.Draw(kitchenfloor[(k + j) % 2], new Vector2(k * GameConstants.tileSize.X, j * GameConstants.tileSize.Y), Color.White);
                        }
                    }
                    #endregion

                    #region furniture + appliances
                    //fridge
                    spriteBatch.Draw(fridge, new Vector2(GameConstants.tileSize.X, GameConstants.tileSize.Y), Color.White);

                    //stove, sink + counter
                    spriteBatch.Draw(counter, new Vector2(5 * GameConstants.tileSize.X, GameConstants.tileSize.Y), Color.White);
                    spriteBatch.Draw(sink, new Vector2(6 * GameConstants.tileSize.X, GameConstants.tileSize.Y), Color.White);
                    spriteBatch.Draw(stove, new Vector2(7 * GameConstants.tileSize.X, GameConstants.tileSize.Y), Color.White);
                    spriteBatch.Draw(countercorner, new Vector2(8 * GameConstants.tileSize.X, GameConstants.tileSize.Y), Color.White);
                    spriteBatch.Draw(countercorner, new Vector2(8 * GameConstants.tileSize.X, 2 * GameConstants.tileSize.Y), Color.White);
                    spriteBatch.Draw(countercorner, new Vector2(8 * GameConstants.tileSize.X, 3 * GameConstants.tileSize.Y), Color.White);
                    spriteBatch.Draw(counter, new Vector2(8 * GameConstants.tileSize.X, 4 * GameConstants.tileSize.Y), Color.White);

                    //table
                    spriteBatch.Draw(table[0, 0], new Vector2(5 * GameConstants.tileSize.X, 6 * GameConstants.tileSize.Y), Color.White);
                    spriteBatch.Draw(table[0, 1], new Vector2(6 * GameConstants.tileSize.X, 6 * GameConstants.tileSize.Y), Color.White);
                    spriteBatch.Draw(table[1, 0], new Vector2(5 * GameConstants.tileSize.X, 7 * GameConstants.tileSize.Y), Color.White);
                    spriteBatch.Draw(table[1, 1], new Vector2(6 * GameConstants.tileSize.X, 7 * GameConstants.tileSize.Y), Color.White);
                    #endregion

                    #region door
                    spriteBatch.Draw(doorcarpetleft, new Vector2(GameConstants.tileSize.X, 7 * GameConstants.tileSize.Y), Color.White);
                    #endregion
                    break;
                case Room.JUNK_ROOM:
                    #region junk
                    foreach (Tuple<int, int> pair in rand_junk)
                    {
                        spriteBatch.Draw(junk, new Vector2(pair.Item1, pair.Item2), Color.White);
                    }
                    #endregion

                    #region screwdriver
                    if (!GameBools.getGameBool(GameBools.GameBool.SCREWDRIVER))
                    {
                        spriteBatch.Draw(screwdriver, new Vector2(RandomizedClueLocations.screwdriver.Item1, RandomizedClueLocations.screwdriver.Item2), Color.White);
                    }
                    #endregion

                    #region door
                    //to study
                    spriteBatch.Draw(doorcarpetleft, new Vector2(1 * GameConstants.tileSize.X, 5 * GameConstants.tileSize.Y), Color.White);

                    //to foyer
                    spriteBatch.Draw(doorcarpetright, new Vector2(8 * GameConstants.tileSize.X, 2 * GameConstants.tileSize.Y), Color.White);
                    #endregion
                    break;
                case Room.STUDY:
                    #region bookshelves
                    for (int i = 1; i <= GameConstants.COL_COUNT - 2; i++)
                        spriteBatch.Draw(bookshelf, new Vector2(i * GameConstants.tileSize.X, 1 * GameConstants.tileSize.Y), Color.White);

                    for (int k = 5; k <= GameConstants.COL_COUNT - 2; k++)
                        spriteBatch.Draw(bookshelfback, new Vector2(k * GameConstants.tileSize.X, 8 * GameConstants.tileSize.Y), Color.White);
                    #endregion

                    #region trapdoor
                    spriteBatch.Draw(trapdoor, new Vector2(3 * GameConstants.tileSize.X, 5 * GameConstants.tileSize.Y), Color.White);
                    #endregion

                    #region desk
                    int pos = GameBools.getGameBool(GameBools.GameBool.DESK_MOVED) ? 1 : 0;
                    spriteBatch.Draw(studydesk[0, 0], new Vector2((2 - pos) * GameConstants.tileSize.X, 3 * GameConstants.tileSize.Y), Color.White);
                    spriteBatch.Draw(studydesk[0, 1], new Vector2((3 - pos) * GameConstants.tileSize.X, 3 * GameConstants.tileSize.Y), Color.White);
                    spriteBatch.Draw(studydesk[1, 0], new Vector2((2 - pos) * GameConstants.tileSize.X, 4 * GameConstants.tileSize.Y), Color.White);
                    spriteBatch.Draw(studydesk[1, 1], new Vector2((3 - pos) * GameConstants.tileSize.X, 4 * GameConstants.tileSize.Y), Color.White);
                    spriteBatch.Draw(studydesk[2, 0], new Vector2((2 - pos) * GameConstants.tileSize.X, 5 * GameConstants.tileSize.Y), Color.White);
                    spriteBatch.Draw(studydesk[2, 1], new Vector2((3 - pos) * GameConstants.tileSize.X, 5 * GameConstants.tileSize.Y), Color.White);
                    #endregion

                    #region door
                    spriteBatch.Draw(doorcarpetright, new Vector2(8 * GameConstants.tileSize.X, 5 * GameConstants.tileSize.Y), Color.White);
                    #endregion
                    break;
                #endregion

                #region SECOND FLOOR
                case Room.UPPER_LANDING:
                    #region stairs
                    spriteBatch.Draw(stairtop[0, 0], new Vector2(4 * GameConstants.tileSize.X - 40, 4 * GameConstants.tileSize.Y), Color.White);
                    spriteBatch.Draw(stairtop[0, 1], new Vector2(4 * GameConstants.tileSize.X + 40, 4 * GameConstants.tileSize.Y), Color.White);
                    spriteBatch.Draw(stairtop[0, 2], new Vector2(5 * GameConstants.tileSize.X + 40, 4 * GameConstants.tileSize.Y), Color.White);
                    spriteBatch.Draw(stairtop[1, 0], new Vector2(4 * GameConstants.tileSize.X - 40, 5 * GameConstants.tileSize.Y), Color.White);
                    spriteBatch.Draw(stairtop[1, 1], new Vector2(4 * GameConstants.tileSize.X + 40, 5 * GameConstants.tileSize.Y), Color.White);
                    spriteBatch.Draw(stairtop[1, 2], new Vector2(5 * GameConstants.tileSize.X + 40, 5 * GameConstants.tileSize.Y), Color.White);

                    spriteBatch.Draw(hole[0], new Vector2(3 * GameConstants.tileSize.X, 4 * GameConstants.tileSize.Y), Color.White);
                    spriteBatch.Draw(hole[2], new Vector2(6 * GameConstants.tileSize.X, 4 * GameConstants.tileSize.Y), Color.White);
                    spriteBatch.Draw(hole[1], new Vector2(3 * GameConstants.tileSize.X, 5 * GameConstants.tileSize.Y), Color.White);
                    spriteBatch.Draw(hole[2], new Vector2(6 * GameConstants.tileSize.X, 5 * GameConstants.tileSize.Y), Color.White);
                    #endregion

                    #region doors
                    //bedroom door
                    spriteBatch.Draw(doorcarpetleft, new Vector2(1 * GameConstants.tileSize.X, 7 * GameConstants.tileSize.Y), Color.White);

                    //broken door
                    spriteBatch.Draw(brokendoor, new Vector2(8 * GameConstants.tileSize.X, 4 * GameConstants.tileSize.Y), Color.White);
                    #endregion
                    break;
                case Room.BEDROOM:
                    #region bed
                    spriteBatch.Draw(bed[0, 0], new Vector2(4 * GameConstants.tileSize.X, GameConstants.tileSize.Y), Color.White);
                    spriteBatch.Draw(bed[0, 1], new Vector2(5 * GameConstants.tileSize.X, GameConstants.tileSize.Y), Color.White);
                    spriteBatch.Draw(bed[0, 2], new Vector2(6 * GameConstants.tileSize.X, GameConstants.tileSize.Y), Color.White);

                    spriteBatch.Draw(bed[1, 0], new Vector2(4 * GameConstants.tileSize.X, 2 * GameConstants.tileSize.Y), Color.White);
                    spriteBatch.Draw(bed[1, 1], new Vector2(5 * GameConstants.tileSize.X, 2 * GameConstants.tileSize.Y), Color.White);
                    spriteBatch.Draw(bed[1, 2], new Vector2(6 * GameConstants.tileSize.X, 2 * GameConstants.tileSize.Y), Color.White);

                    spriteBatch.Draw(bed[2, 0], new Vector2(4 * GameConstants.tileSize.X, 3 * GameConstants.tileSize.Y), Color.White);
                    spriteBatch.Draw(bed[2, 1], new Vector2(5 * GameConstants.tileSize.X, 3 * GameConstants.tileSize.Y), Color.White);
                    spriteBatch.Draw(bed[2, 2], new Vector2(6 * GameConstants.tileSize.X, 3 * GameConstants.tileSize.Y), Color.White);
                    #endregion

                    #region key
                    if (!GameBools.getGameBool(GameBools.GameBool.STUDY_KEY))
                    {
                        spriteBatch.Draw(key, new Vector2(RandomizedClueLocations.studyKey.Item1 * GameConstants.tileSize.X,
                                                            RandomizedClueLocations.studyKey.Item2 * GameConstants.tileSize.Y),
                                              Color.White);
                    }
                    #endregion

                    #region cupboard
                    //Leftside of bed
                    spriteBatch.Draw(cupboard[0], new Vector2(GameConstants.tileSize.X, GameConstants.tileSize.Y), Color.White);
                    spriteBatch.Draw(cupboard[1], new Vector2(2 * GameConstants.tileSize.X, GameConstants.tileSize.Y), Color.White);

                    //Right side of bed
                    spriteBatch.Draw(cupboard[0], new Vector2(7 * GameConstants.tileSize.X, GameConstants.tileSize.Y), Color.White);
                    spriteBatch.Draw(cupboard[1], new Vector2(8 * GameConstants.tileSize.X, GameConstants.tileSize.Y), Color.White);
                    #endregion

                    #region mirror
                    //replace with mirror texture
                    spriteBatch.Draw(mirror[0], new Vector2(GameConstants.tileSize.X, 6 * GameConstants.tileSize.Y), Color.White);
                    #endregion

                    #region door
                    spriteBatch.Draw(doorcarpetright, new Vector2(8 * GameConstants.tileSize.X, 7 * GameConstants.tileSize.Y), Color.White);
                    #endregion
                    break;
                #endregion

                #region BASEMENT
                case Room.LOWER_LANDING:
                    #region Walls
                    for (int i = 1; i <= GameConstants.COL_COUNT - 2; i++)
                    {
                        spriteBatch.Draw(stonewall, new Vector2(i * GameConstants.tileSize.X, 0), Color.White);
                    }

                    #endregion

                    #region floor
                    for (int k = 1; k <= GameConstants.COL_COUNT - 2; k++)
                    {
                        for (int j = 1; j <= GameConstants.ROW_COUNT - 2; j++)
                        {
                            spriteBatch.Draw(stonefloor, new Vector2(k * GameConstants.tileSize.X, j * GameConstants.tileSize.Y), Color.White);
                        }
                    }
                    #endregion

                    #region stairs
                    spriteBatch.Draw(lower_stair[0], new Vector2(8 * GameConstants.tileSize.X, 4 * GameConstants.tileSize.Y - 40), Color.White);
                    spriteBatch.Draw(lower_stair[1], new Vector2(8 * GameConstants.tileSize.X, 4 * GameConstants.tileSize.Y + 40), Color.White);
                    spriteBatch.Draw(lower_stair[2], new Vector2(8 * GameConstants.tileSize.X, 5 * GameConstants.tileSize.Y + 40), Color.White);
                    #endregion

                    #region boxes
                    foreach (int i in new int[]{2, 4, 6})
                    {
                        foreach (int j in new int[]{2, 6})
                            spriteBatch.Draw(box, new Vector2(i * GameConstants.tileSize.X, j * GameConstants.tileSize.Y), Color.White);
                    }
                    #endregion

                    #region door
                    spriteBatch.Draw(doorcarpetright, new Vector2(8 * GameConstants.tileSize.X, 2 * GameConstants.tileSize.Y), Color.White);
                    #endregion
                    break;
                case Room.BASEMENT:
                    #region Walls
                    for (int i = 1; i <= GameConstants.COL_COUNT - 2; i++)
                    {
                        spriteBatch.Draw(stonewall, new Vector2(i * GameConstants.tileSize.X, 0), Color.White);
                    }

                    #endregion

                    #region floor
                    for (int k = 1; k <= GameConstants.COL_COUNT - 2; k++)
                    {
                        for (int j = 1; j <= GameConstants.ROW_COUNT - 2; j++)
                        {
                            spriteBatch.Draw(stonefloor, new Vector2(k * GameConstants.tileSize.X, j * GameConstants.tileSize.Y), Color.White);
                        }
                    }
                    #endregion

                    #region door
                    spriteBatch.Draw(doorcarpetleft, new Vector2(1 * GameConstants.tileSize.X, 2 * GameConstants.tileSize.Y), Color.White);
                    spriteBatch.Draw(doorcarpetright, new Vector2(8 * GameConstants.tileSize.X, 7 * GameConstants.tileSize.Y), Color.White);
                    #endregion

                    #region hole
                    foreach (int i in new int[] { 1, 2, 3, 4 })
                    {
                        spriteBatch.Draw(bighole[0], new Vector2(i * GameConstants.tileSize.X, (i + 4) * GameConstants.tileSize.Y), Color.White);
                    }

                    foreach (int i in new int[] { 2, 3, 4 })
                    {
                        spriteBatch.Draw(bighole[1], new Vector2(i * GameConstants.tileSize.X, (i + 3) * GameConstants.tileSize.Y), Color.White);
                    }

                    spriteBatch.Draw(bighole[2], new Vector2(1 * GameConstants.tileSize.X, 6 * GameConstants.tileSize.Y), Color.White);
                    spriteBatch.Draw(bighole[2], new Vector2(1 * GameConstants.tileSize.X, 7 * GameConstants.tileSize.Y), Color.White);
                    spriteBatch.Draw(bighole[2], new Vector2(1 * GameConstants.tileSize.X, 8 * GameConstants.tileSize.Y), Color.White);
                    spriteBatch.Draw(bighole[2], new Vector2(2 * GameConstants.tileSize.X, 7 * GameConstants.tileSize.Y), Color.White);
                    spriteBatch.Draw(bighole[2], new Vector2(2 * GameConstants.tileSize.X, 8 * GameConstants.tileSize.Y), Color.White);
                    spriteBatch.Draw(bighole[2], new Vector2(3 * GameConstants.tileSize.X, 8 * GameConstants.tileSize.Y), Color.White);
                    #endregion 

                    #region boxes
                    spriteBatch.Draw(box, new Vector2(2 * GameConstants.tileSize.X, 2 * GameConstants.tileSize.Y), Color.White);
                    spriteBatch.Draw(box, new Vector2(6 * GameConstants.tileSize.X, 2 * GameConstants.tileSize.Y), Color.White);
                    spriteBatch.Draw(box, new Vector2(6 * GameConstants.tileSize.X, 6 * GameConstants.tileSize.Y), Color.White);
                    #endregion
                    break;
                case Room.RESEARCH_LAB:
                    #region Walls
                    for (int i = 1; i <= GameConstants.COL_COUNT - 2; i++)
                    {
                        spriteBatch.Draw(stonewall, new Vector2(i * GameConstants.tileSize.X, 0), Color.White);
                    }

                    #endregion

                    #region floor
                    for (int k = 1; k <= GameConstants.COL_COUNT - 2; k++)
                    {
                        for (int j = 1; j <= GameConstants.ROW_COUNT - 2; j++)
                        {
                            spriteBatch.Draw(labfloor, new Vector2(k * GameConstants.tileSize.X, j * GameConstants.tileSize.Y), Color.White);
                        }
                    }
                    #endregion

                    #region door
                    spriteBatch.Draw(doorcarpetleft, new Vector2(1 * GameConstants.tileSize.X, 7 * GameConstants.tileSize.Y), Color.White);
                    #endregion

                    #region lab equipment
                    foreach (int i in new int[] { 2, 6 })
                    {
                        foreach(int j in new int[] {0, 3, 6})
                        {
                            spriteBatch.Draw(lab_equipment[0, 0], new Vector2(i * GameConstants.tileSize.X, j * GameConstants.tileSize.Y), Color.White);
                            spriteBatch.Draw(lab_equipment[0, 1], new Vector2((i+1) * GameConstants.tileSize.X, j * GameConstants.tileSize.Y), Color.White);
                            spriteBatch.Draw(lab_equipment[1, 0], new Vector2(i * GameConstants.tileSize.X, (j+1) * GameConstants.tileSize.Y), Color.White);
                            spriteBatch.Draw(lab_equipment[1, 1], new Vector2((i+1) * GameConstants.tileSize.X, (j+1) * GameConstants.tileSize.Y), Color.White);
                        }
                    }
                    #endregion
                    break;
                #endregion


            }

            #endregion

            DrawRandomFurniture(spriteBatch, current_room);
            DrawResearchNote(spriteBatch, current_room);
        }

        static private void DrawRandomFurniture(SpriteBatch spriteBatch, Room current_room)
        {
            if (Randomization.RandomizedFurniture.random_furniture.ContainsKey(current_room))
                foreach (Randomization.Furniture f in Randomization.RandomizedFurniture.random_furniture[current_room])
                {
                    spriteBatch.Draw(f.texture, new Vector2(f.location.X, f.location.Y), Color.White);
                }
        }

        static private void DrawResearchNote(SpriteBatch spriteBatch, Room current_room)
        {
            foreach (Randomization.ResearchNote rnote in Randomization.RandomResearchNotes.research_notes)
            {
                if (rnote.getRoom().Equals(current_room))
                {
                    if (!rnote.isFound())
                    {
                        spriteBatch.Draw(note[0], new Vector2(rnote.getX() * GameConstants.tileSize.X, rnote.getY() * GameConstants.tileSize.Y), Color.White);
                    }
                }
            }
        }
    }
}
